﻿using Eneta.Portal.Forum.Core.Domain.Repositories;

namespace Eneta.Portal.Forum.Core.Service.Application
{
    public class RepositoryRegistry
    {
        // Fields
        private static readonly RepositoryRegistry instance = new RepositoryRegistry();

        // Methods
        protected RepositoryRegistry()
        {
        }

        protected CategoryRepository GetCategoryRepository()
        {
            return new CategoryRepository();
        }

        protected ForumRepository GetForumRepository()
        {
            return new ForumRepository();
        }

        protected ForumUserRepository GetForumUserRepository()
        {
            return new ForumUserRepository();
        }

        protected GroupRepository GetGroupRepository()
        {
            return new GroupRepository();
        }

        private static RepositoryRegistry GetInstance()
        {
            return instance;
        }

        protected MessageRepository GetMessageRepository()
        {
            return new MessageRepository();
        }

        protected TopicRepository GetTopicRepository()
        {
            return new TopicRepository();
        }

        // Properties
        public static CategoryRepository CategoryRepository
        {
            get
            {
                return GetInstance().GetCategoryRepository();
            }
        }

        public static ForumRepository ForumRepository
        {
            get
            {
                return GetInstance().GetForumRepository();
            }
        }

        public static ForumUserRepository ForumUserRepository
        {
            get
            {
                return GetInstance().GetForumUserRepository();
            }
        }

        public static GroupRepository GroupRepository
        {
            get
            {
                return GetInstance().GetGroupRepository();
            }
        }

        public static MessageRepository MessageRepository
        {
            get
            {
                return GetInstance().GetMessageRepository();
            }
        }

        public static TopicRepository TopicRepository
        {
            get
            {
                return GetInstance().GetTopicRepository();
            }
        }
    }
}
